package cn.cnic.user.component.system.ctrl;

import cn.cnic.user.component.system.service.IPersonServices;
import cn.cnic.user.vo.PersonVo;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping(value = "/person")
public class PersonCtrl {


    @Resource
   private IPersonServices IPersonServices;

    @RequestMapping(value = "/personSave", method = RequestMethod.POST, produces = "text/html; charset=UTF-8")
    @ResponseBody
    public String projectSave(HttpServletRequest request, PersonVo personVo, BindingResult bindingResult,@RequestParam("avatar") MultipartFile avatar) {
        return IPersonServices.savePersonVo(request, personVo,avatar);
    }

    @RequestMapping("/personInput")
    @ResponseBody
    public ModelAndView personInput() {
        return new ModelAndView("person-info-input");
    }

}
